import Joi from 'joi'
import Router from 'koa-router'
import { CreateComment, GetComments } from '../controller'
import idempotent from '../middlewares/redlock'
import validate from '../middlewares/validator'
import { createCommentRule } from './validatorRules'

const router = new Router()
router.prefix('/comment')
router.post('/create/:blogid', idempotent(), validate(createCommentRule), CreateComment)
router.get('/getlist/:blogid', validate({ page: Joi.number(), limit: Joi.number() }), GetComments)

export default router
